import { get } from 'jquery';
import { createStore } from 'vuex'
import axios from "axios";

export default createStore({
  state: {
    userInfo: {
      username: '',
      password: '',
      tel: '',
      lib: "",
      brand: "",
      local: "",
      balance: 1200,
      isLogin: false
    },
    ProductCart: [],
    PayData: []
  },
  getters: {
  },
  mutations: {
    // 登录
    // 注销
    loginOut(state) {
      axios.get('http://localhost:5000/deluser', {  //params参数必写 , 如果没有参数传{}也可以
        params: {
          username: state.userInfo.username,
        }
      }).then(res => (
        console.log(res.data)
      )).catch(function (error) { // 请求失败处理
        console.log(error);
      });
      state.userInfo = { username: '', password: '', isLogin: false }
    },
  },
  actions: {
  },
  modules: {
  }
})
